/*
 *    Copyright 2008-2009 The PoCo Team
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */
package com.asemantics.poco.services;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;

import com.asemantics.poco.DateTime;
import com.asemantics.poco.Response;
import com.asemantics.poco.query.Filter;
import com.asemantics.poco.query.FilterOp;
import com.asemantics.poco.query.Format;
import com.asemantics.poco.query.Pagination;
import com.asemantics.poco.query.Presentation;
import com.asemantics.poco.query.SortOrder;
import com.asemantics.poco.query.Sorting;

/**
 * 
 * @author Simone Tripodi
 * @version $Id: AbstractPoCoService.java 268 2009-12-21 08:53:07Z simone.tripodi@gmail.com $
 */
@Path("@me")
public abstract class AbstractPoCoService {

    @GET
    @Path("@all")
    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
    public final Response getAll(
            // 6.3.1.  Filtering
            @QueryParam(Filter.FILTER_BY) String filterBy,
            @QueryParam(Filter.FILTER_OP) FilterOp filterOp,
            @QueryParam(Filter.FILTER_VALUE) String filterValue,
            @QueryParam(Filter.UPDATED_SINCE) DateTime updatedSince,
            // 6.3.2.  Sorting
            @QueryParam(Sorting.SORT_BY) String sortBy,
            @QueryParam(Sorting.SORT_ORDER) SortOrder sortOrder,
            // 6.3.3.  Pagination
            @QueryParam(Pagination.START_INDEX) int startIndex,
            @QueryParam(Pagination.COUNT) int count,
            // 6.3.4.  Presentation
            @QueryParam(Presentation.FIELDS) String[] fields,
            @QueryParam(Presentation.FORMAT) Format format) {
        return null;
    }

    @GET
    @Path("@all/{userId:\\w.+}")
    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
    public final Response getUser(@PathParam("userId") String userId,
            // 6.3.1.  Filtering
            @QueryParam(Filter.FILTER_BY) String filterBy,
            @QueryParam(Filter.FILTER_OP) FilterOp filterOp,
            @QueryParam(Filter.FILTER_VALUE) String filterValue,
            @QueryParam(Filter.UPDATED_SINCE) DateTime updatedSince,
            // 6.3.2.  Sorting
            @QueryParam(Sorting.SORT_BY) String sortBy,
            @QueryParam(Sorting.SORT_ORDER) SortOrder sortOrder,
            // 6.3.3.  Pagination
            @QueryParam(Pagination.START_INDEX) int startIndex,
            @QueryParam(Pagination.COUNT) int count,
            // 6.3.4.  Presentation
            @QueryParam(Presentation.FIELDS) String[] fields,
            @QueryParam(Presentation.FORMAT) Format format) {
        return null;
    }

    @GET
    @Path("@self")
    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
    public final Response getSelf(
            // 6.3.1.  Filtering
            @QueryParam(Filter.FILTER_BY) String filterBy,
            @QueryParam(Filter.FILTER_OP) FilterOp filterOp,
            @QueryParam(Filter.FILTER_VALUE) String filterValue,
            @QueryParam(Filter.UPDATED_SINCE) DateTime updatedSince,
            // 6.3.2.  Sorting
            @QueryParam(Sorting.SORT_BY) String sortBy,
            @QueryParam(Sorting.SORT_ORDER) SortOrder sortOrder,
            // 6.3.3.  Pagination
            @QueryParam(Pagination.START_INDEX) int startIndex,
            @QueryParam(Pagination.COUNT) int count,
            // 6.3.4.  Presentation
            @QueryParam(Presentation.FIELDS) String[] fields,
            @QueryParam(Presentation.FORMAT) Format format) {
        return null;
    }

}
